(defun calctxt (txt / )
  (setq tmp-txt txt
	orig-len (strlen txt)
  )
  (if (and
	(wcmatch txt "*([-+/*] #*#)*");text possibly contains an autolisp math function
	(not (wcmatch txt "*([-+/*] #*@*#)*"));but not if alpha characters are in it
      )
    (progn
      (while (not (wcmatch tmp-txt "([-+/*] #*#)*"));separate the lead-in text
        (setq tmp-txt (substr tmp-txt 2))
      )
      (setq txt-len1 (- orig-len (strlen tmp-txt)))
      (while (not (wcmatch tmp-txt "([-+/*] #*#)"))
        (setq tmp-txt (substr tmp-txt 1 (1-(strlen tmp-txt))))
      )
    )
  )
  (if (and
	(wcmatch tmp-txt "([-+/*] #*#)");text possibly contains an autolisp math function
    	(not (wcmatch txt "*([-+/*] #*@*#)*"));but not if alpha characters are in it
      )
    (progn ;separate any following text
      (setq txt-p1 (substr txt 1 txt-len1)
	    calc-txt (rtos (eval (read tmp-txt))2 2)
      )
      (if (wcmatch txt "*([-+/*] #*#)")
	(setq txt-p2 "")
	(setq txt-p2 (substr txt (+ txt-len1 (1+ (strlen tmp-txt)))))
      )
      (setq calcd-txt (strcat txt-p1 calc-txt txt-p2))
    )
    (setq calcd-txt txt)
  )
)